Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

Get tracker value for the selected token - workaround for @{tracker|@{selected|token_name}} not working

I couldn't find an answer to this problem when I searched the forums, but I ended up solving it myself, so hopefully this can be helpful to someone else. Macros support setting and modifying the tracker value of the selected token via the roll options &{tracker} &{tracker:+} &{tracker:-} and retrieving the tracker value of a named item via @{tracker| Item Name } but there is no syntax for retrieving the tracker value for the selected token. The syntax @{tracker|@{selected|token_name}} does not work, because the @{tracker| part is evaluated first, which tries to find "@{selected" on the turn tracker instead of the value you get from "@{selected|token_name}". However, it is possible to work around this in the following way. Create a character called, for example, "GAME", in order to store an attribute. Give that character an attribute called, for example, "TRACKER", with the value "@{tracker". The following syntax now gives the tracker value for the selected token (note the double-close-bracket at the end). @{GAME|TRACKER}@{selected|character_name}} Optional 4. Put the above into a macro, say "#selectedTrackerValue", for code clarity / convenience. More generally, you could use this approach to work around a lot of (all??) obstacles caused by the whole "macros don't support nested operations" thing.
1598383401
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You might be able to find additional useful stuff along these lines in this Stupid Trick .
keithcurtis said: You might be able to find additional useful stuff along these lines in this Stupid Trick . That looks like a really interesting thread to keep an eye on. Thanks!